<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/4.7.0/css/font-awesome.css">
    <link href="framework/reset.css" rel="stylesheet">
    <link href="css/login.css" rel="stylesheet">
    <title>饿了么 用户登陆</title>
</head>

<body>
    <div class="wrapper" >

        <!-- header部分 -->
        <header>
            <p>用户登陆</p>
        </header>

        <!-- 表单部分 -->
        <div id="login">
            <ul class="form-box">
                <li>
                    <div class="title">
                        手机号码：
                    </div>
                    <div class="content">
                        <input type="text" placeholder="手机号码" v-model="phoneNumber">
                    </div>
                </li>
                <li>
                    <div class="title">
                        密码：
                    </div>
                    <div class="content">
                        <input type="password" placeholder="密码" v-model="password">
                    </div>
                </li>
            </ul>
    
            <div class="button-login">
                <button @click="login()">登陆</button>
            </div>
            <div class="button-register">
                <button onclick="location.href='register.html'">去注册</button>
            </div>
        </div>
        

        <!-- 底部菜单部分 -->
        <ul class="footer" id="footer">
            
            <li onclick="location.href='index.html'">
                <i class="fa fa-home"></i>
                <p>首页</p>
            </li>
            <li @click="fz">
                <i class="fa fa-compass"></i>
                <p>发现{{tips}}</p>
            </li>
            <li onclick="location.href='orderList.html'">
                <i class="fa fa-file-text-o"></i>
                <p>订单</p>
            </li>
            <li>
                <i class="fa fa-user-o"></i>
                <p>我的</p>
            </li>
        </ul>
    </div>
    <script src="https://fastly.jsdelivr.net/npm/vue@2.7.14/dist/vue.js"></script>
    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
    <script src="js/pageJump.js"></script>
    <script>
        var path=getRequestPath()
        var login=new Vue({
            el:"#login",
            data:{
                
                phoneNumber:null,
                password:null
            },
            methods:{
                login:function(){
                    axios.post(path+"/UserController/getUserByIdByPass",null,{
                        params:{
                            userId:this.phoneNumber,
                            password:this.password
                        }
                    }).then((respon)=>{
                        if(respon.data.code==200){
                            window.localStorage.removeItem("Auth")
                            window.localStorage.setItem("Auth",respon.data.detail.JWT)
                            window.location.href='index.html';
                        }
                    }).catch((error)=>{
                        console.log(error)
                    })
                }
            }
        });

        var footer=new Vue({
            el:".footer",
            data:{
                tips:''
            },
            methods:{
                fz:function(){
                    this.tips="ah"
                }
            }
        })
    </script>
</body>

</html>